import Router from 'vue-router';
import Vue from 'vue';
Vue.use(Router);

export default new Router({
    mode: 'history',
    routes: [{
        path: '/',
        redirect: '/product'
    },

    {
        path: '/product',
        // 路由对应组件
        component: () => import('@/views/product/index'),
        redirect: '/product/list',
        // 配置子路由
        children: [{
            path: 'list',
            component: () => import('@/views/product/children/list')
        },
        {
            path: 'detail/:productId',
            name: 'detail',
            component: () => import('@/views/product/children/detail')
        }
        ]
    },
    {
        path: '/classify',
        component: () => import('@/views/classify/classification')
    },
    {
        path: '/cart',
        component: () => import('@/views/cart/shopping')
    },
    {
        path: '/my',
        name: 'getmy',
        component: () => import('@/views/my/index'),
        redirect: '/my/personalCenter',
        children: [{
            path: '/my/personalCenter',
            component: () => import('@/views/my/theLogin/personalCenter')
        }, {
            path: '/my/registered',
            component: () => import('@/views/my/theLogin/registered')
        },
        {
            path: '/my/theNo',
            component: () => import('@/views/my/theLogin/theNo')
        },
        {
            path: '/my/setting',
            component: () => import('@/views/my/theLogin/setting')
        },

        ]

    },

    {
        path: '/demo',
        component: () => import('@/components/Demo')
    },
    {
        path: '*',
        component: () => import('@/components/NotFound')
    }
    ]
});